<!doctype html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/static/vendor/reset.css">
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/vendor/layui/css/layui.css?v=<?=env('version')?>">
    <script type="text/javascript" src="/static/vendor/layui/layui.js?v=<?=env('version')?>"></script>
    <script type="text/javascript" src="/static/vendor/function.js?v=<?=env('version')?>"></script>
    <script src="/static/vendor/function.js"></script>
    <title><?=$info['title']?></title>
    <style>
    .wrapper{max-width: 750px;margin: 0px auto;}
    .pics img{width: 100%;}
    </style>
  </head>
  <body>
    <div class="wrapper">
      <div class="pics">
    <?php
    $pics = explode(",",$info['pics']);
    foreach($pics as $v):?><img src="<?=$v?>" /><?php endforeach;?>
    </div>
    <div class="content">
      <?=htmlspecialchars_decode($info['content']);?>
    </div>
    <div class="message">
      <form  class="layui-form layui-form-pane" action="<?=url('index/add')?>">
        <input type="hidden" name="xcdy_id" value="<?=$info['id']?>" />
        <div class="layui-form-item">
          <label class="layui-form-label">姓名</label>
          <div class="layui-input-block">
            <input type="text" name="name" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">电话</label>
          <div class="layui-input-block">
            <input type="text" name="phone" placeholder="请输入电话" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">QQ/微信/邮箱</label>
          <div class="layui-input-block">
            <input type="text" name="other" placeholder="请输入QQ/微信/邮箱" autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item layui-form-text">
          <label class="layui-form-label">留言内容</label>
          <div class="layui-input-block">
            <textarea name="content" placeholder="请输入留言内容" class="layui-textarea"></textarea>
          </div>
        </div>
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="myform">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
          </div>
        </div>
      </form>

    </div>
  </div>
  </body>
  <script>
  var url = window.location.href.split('#')[0];
  //微信jssdk
  $.ajax({
    url:"<?=url('index/index')?>",
    method:"post",
    dataType:"json",
    data:{share_url:encodeURIComponent(url)},
    success:function(res){
      wx.config(JSON.parse(res.data));
    },
  });
  wx.ready(function() {
      var obj = {
          title: "<?=$info['title']?>",
          desc: "<?=$info['description']?>",
          link: url,
          imgUrl: "<?=pic($info['pic'])?>",
          success: function() {},
          cancel: function() {},
          fail: function (res) {
              alert(JSON.stringify(res));
          }
      };
      // 2.1 监听“分享给朋友”，按钮点击、自定义分享内容及分享结果接口
      wx.onMenuShareAppMessage(obj);
      // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
      wx.onMenuShareTimeline(obj);
      // 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
      wx.onMenuShareQQ(obj);
      // 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
      wx.onMenuShareWeibo(obj);
      // 2.5 监听“分享到QZone”按钮点击、自定义分享内容及分享接口
      wx.onMenuShareQZone(obj);
  });
  //分享错误
  wx.error(function(err) {
    alert(JSON.stringify(err))
  });
  </script>
</html>
